package action.client;


import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;

import servletunit.struts.MockStrutsTestCase;

public class TestAjoutCompteClientAction extends MockStrutsTestCase{

	@Before
	public void setUp() throws Exception {
		super.setUp();
	}

	@After
	public void tearDown() throws Exception {
	}

	public void testAjoutCompteClientAvecService(){
		setRequestPathInfo("/AjoutCompteClientAction");
		getRequest().getSession().setAttribute("id_compte", "1");
		addRequestParameter("civilite", "M");
		addRequestParameter("compteDeService", "123");
		addRequestParameter("nomClient", "Boula");
		addRequestParameter("prenomClient", "James");
		addRequestParameter("jour_client", "12");
		addRequestParameter("mois", "06");
		addRequestParameter("annee", "2004");
		addRequestParameter("telephone_portable", "0602030405");
		addRequestParameter("telephone_fixe", "0102030405");
		addRequestParameter("rue_client", "6 rue de la Paix");
		addRequestParameter("rue_client_suite", "");
		addRequestParameter("ville_client", "Paris");
		addRequestParameter("code_postal_client", "75012");
		addRequestParameter("pays_client", "France");
		addRequestParameter("nomService", "RH");
		
		actionPerform();
		verifyForward("success");
	}
	
	public void testAjoutCompteClientVerifServiceCompte(){
		setRequestPathInfo("/AjoutCompteClientAction");
		getRequest().getSession().setAttribute("id_compte", "1");
		addRequestParameter("civilite", "M");
		addRequestParameter("compteDeService", "1");
		addRequestParameter("nomClient", "Boula");
		addRequestParameter("prenomClient", "James");
		addRequestParameter("jour_client", "12");
		addRequestParameter("mois", "06");
		addRequestParameter("annee", "2004");
		addRequestParameter("telephone_portable", "0602030405");
		addRequestParameter("telephone_fixe", "0102030405");
		addRequestParameter("rue_client", "6 rue de la Paix");
		addRequestParameter("rue_client_suite", "");
		addRequestParameter("ville_client", "Paris");
		addRequestParameter("code_postal_client", "75012");
		addRequestParameter("pays_client", "France");
		addRequestParameter("nomService", "");
		
		actionPerform();
		verifyInputForward();
	}
	
	public void testAjoutCompteClientSansNom(){
		setRequestPathInfo("/AjoutCompteClientAction");
		getRequest().getSession().setAttribute("id_compte", "");
		addRequestParameter("civilite", "");
		addRequestParameter("compteDeService", "");
		addRequestParameter("nomClient", "");
		addRequestParameter("prenomClient", "");
		addRequestParameter("jour_client", "");
		addRequestParameter("mois", "");
		addRequestParameter("annee", "");
		addRequestParameter("telephone_portable", "");
		addRequestParameter("telephone_fixe", "");
		addRequestParameter("rue_client", "");
		addRequestParameter("rue_client_suite", "");
		addRequestParameter("ville_client", "");
		addRequestParameter("code_postal_client", "");
		addRequestParameter("pays_client", "");
		addRequestParameter("nomService", "");
		
		actionPerform();
		verifyInputForward();
	}
	
	public void testAjoutCompteClientSansPrenom(){
		setRequestPathInfo("/AjoutCompteClientAction");
		getRequest().getSession().setAttribute("id_compte", "");
		addRequestParameter("civilite", "");
		addRequestParameter("compteDeService", "");
		addRequestParameter("nomClient", "Boula");
		addRequestParameter("prenomClient", "");
		addRequestParameter("jour_client", "");
		addRequestParameter("mois", "");
		addRequestParameter("annee", "");
		addRequestParameter("telephone_portable", "");
		addRequestParameter("telephone_fixe", "");
		addRequestParameter("rue_client", "");
		addRequestParameter("rue_client_suite", "");
		addRequestParameter("ville_client", "");
		addRequestParameter("code_postal_client", "");
		addRequestParameter("pays_client", "");
		addRequestParameter("nomService", "");
		
		actionPerform();
		verifyInputForward();
	}
	
	
	
	
}
